{% extends "base.html" %}

{% block title %}Add journal entry{% endblock %}

{% block header %}
<h1>{% if object %}Modify journal entry{% else %}Add journal entry{% endif %}</h1>
{% endblock %}

{% block current_path %}
    <p>Locomotives ({{ loc }})&rsaquo; Journal entry ({% if object %}modify{% else %}create{% endif %})</p>
{% endblock %}

{% block content %}

<form action="" method="post">
    {% if object %}
        <label for="id_locomotive">Locomotive</label>
        {{ form.locomotive }}
        {% if form.model.errors %}
            <span class="error">
                {{ form.locomotive.errors|join:", " }}
            </span>
        {% endif %}
    {% else %}
        <input type="hidden" name="locomotive" value="{{ loc.id }}" />
    {% endif %}

    <p>
        <label for="id_log_date">Date:</label>
        {{ form.log_date }}
        {% if form.model.errors %}
            <span class="error">
                {{form.log_date.errors|join:", "}}
            </span>
        {% endif %}
    </p>
    
    <p>
        <label for="id_log_record">Text:</label> 
        {{ form.log_record }}
        {% if form.loc_number.errors %}
            <span class="error">
                {{form.log_record.errors|join:", "}}
            </span>
        {% endif %}
    </p>

    <p>
        <input type="submit" value="{% if object %}Save{% else %}Add{% endif %}">
    </p>
</form>

{% endblock %}

